﻿Public Class Form1

    Dim regthirty_two As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Rockstar Games\"
    Dim regsixty_four As String = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Rockstar Games\"
    Dim GTAIVREG As String = "Grand Theft Auto IV\"
    Dim EFLCREG As String = "EFLC\"
    Dim FileName As String = "InstallFolder"
    Dim FilePath As Object
    Dim RegistryKey As Object

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim openf As FolderBrowserDialog = New FolderBrowserDialog
        openf.ShowDialog()
        openf.ShowNewFolderButton = True
        TextBox1.Text = openf.SelectedPath

    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub FixBTN_Click(sender As System.Object, e As System.EventArgs) Handles FixBTN.Click
        FilePath = TextBox1.Text
        RegistryKey = CreateObject("WScript.Shell")
        Try
            If THRDB.Checked = True Then
                If GTAIVRDB.Checked = True Then
                    RegistryKey.RegWrite(regthirty_two + GTAIVREG + FileName, FilePath)
                    FixDone()
                ElseIf EFLCRDB.Checked = True Then
                    RegistryKey.RegWrite(regthirty_two + EFLCREG + FileName, FilePath)
                    FixDone()
                End If
            ElseIf SIRDB.Checked = True Then
                If GTAIVRDB.Checked = True Then
                    RegistryKey.RegWrite(regsixty_four + GTAIVREG + FileName, FilePath)
                    FixDone()
                ElseIf EFLCRDB.Checked = True Then
                    RegistryKey.RegWrite(regsixty_four + EFLCREG + FileName, FilePath)
                    FixDone()
                End If
            End If
        Catch ex As Exception
            MessageBox.Show("Something's Wrong!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub

    Private Sub FixDone()
        MessageBox.Show("Fix Done!", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub
End Class
